<?php

namespace Apps\Common\Models;

/**
 * 操作员分组Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class BackendOperatorGroup extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $group_id;

    /**
     *
     * @var string
     */
    public $group_name;

    /**
     *
     * @var string
     */
    public $group_remark;

    /**
     *
     * @var integer
     */
    public $group_state;

    /**
     *
     * @var string
     */
    public $group_addtime;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->hasMany('group_id', 'Apps\Common\Models\BackendOperator', 'operator_group', array('alias' => 'BackendOperator'));
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'backend_operator_group';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return BackendOperatorGroup[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return BackendOperatorGroup
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'group_id' => 'group_id',
            'group_name' => 'group_name',
            'group_remark' => 'group_remark',
            'group_state' => 'group_state',
            'group_addtime' => 'group_addtime'
        );
    }

    public function defaultColumns()
    {
        return [
            'group_remark',
            'group_state',
            'group_addtime',
        ];
    }
}
